import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
// 方法一
// import indexPage from '../views/index.vue'
// import loginPage from '../views/login.vue'

// const routes = [
//     { path: '/',component: indexPage },
//     { path: '/login',component:loginPage }
// ]
//方法二
const routes = [
    { path: '/',redirect: '/login'},
    { 
        path: '/index',
        component:() => import ('../views/index'),
        // redirect: '/index/banner',//跳转默认轮播图管理
        children: [
            { path: 'banner',meta:{ title: '轮播图管理'},component:() => import ('../views/shouye/banner')},
            { path: 'category',meta:{ title: '分类区管理'},component:() => import ('../views/shouye/category')}, 
            { path: 'recommend',meta:{ title: '为你推荐管理'},component:() => import ('../views/shouye/recommend')},
            { path: 'brand',meta:{ title: '品牌管理'},component:() => import ('../views/product/brand')},
            { path: 'product',meta:{ title: '商品管理'},component:() => import ('../views/product/product')}, 
            { path: 'variety',meta:{ title: '分类管理'},component:() => import ('../views/product/variety')},
            { path: 'singalProduct',meta:{ title: '单品管理'},component:() => import ('../views/product/singalProduct')}
        ]
    },
    { path: '/login',component:() => import ('../views/login') }
]
const router = new VueRouter({
    routes
})
export default router